package com.hytc.mymall.activity.login;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.InputType;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bigkoo.svprogresshud.SVProgressHUD;
import com.hytc.mymall.R;
import com.hytc.mymall.activity.HomeActivity;
import com.hytc.mymall.application.ActivityManager;
import com.hytc.mymall.base.BaseActivity;
import com.hytc.mymall.bean.AccountBean;
import com.hytc.mymall.bean.LoginBean;
import com.hytc.mymall.db.AccountBD;
import com.hytc.mymall.http.OkHttpClientManager;
import com.hytc.mymall.http.StringPopCallBack;
import com.hytc.mymall.pop.AccountSelectPop;
import com.hytc.mymall.pop.LoginStylePop;
import com.hytc.mymall.pop.SelectPopCallback;
import com.hytc.mymall.utils.GsonUtils;
import com.hytc.mymall.utils.MD5Utils;
import com.hytc.mymall.utils.ToastUtils;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;


public class LoginActivity extends BaseActivity {

    @BindView(R.id.iv_title_left)
    ImageView ivTitleLeft;
    @BindView(R.id.rl_back)
    RelativeLayout rlBack;
    @BindView(R.id.toolbar_title)
    TextView toolbarTitle;
    @BindView(R.id.toolbar_title_arrow)
    ImageView toolbarTitleArrow;
    @BindView(R.id.rl_title)
    RelativeLayout rlTitle;
    @BindView(R.id.iv_mynews)
    ImageView ivMynews;
    @BindView(R.id.tv_info_commit)
    TextView tvInfoCommit;
    @BindView(R.id.rl_right)
    RelativeLayout rlRight;
    @BindView(R.id.tv_regist_loginstyle)
    TextView tvRegistLoginstyle;
    @BindView(R.id.iv_regist_loginstyle)
    ImageView ivRegistLoginstyle;
    @BindView(R.id.ll_regist_loginstyle)
    LinearLayout llRegistLoginstyle;
    @BindView(R.id.et_regist_phonenumber)
    EditText etRegistPhonenumber;
    @BindView(R.id.iv_regist_phonenumber)
    ImageView ivRegistPhonenumber;
    @BindView(R.id.et_regist_psw)
    EditText etRegistPsw;
    @BindView(R.id.iv_regist_psw)
    ImageView ivRegistPsw;
    @BindView(R.id.tv_login_forgetpsw)
    TextView tvLoginForgetpsw;
    @BindView(R.id.tv_login_regist)
    TextView tvLoginRegist;
    @BindView(R.id.btn_regist_login)
    Button btnRegistLogin;
    private int loginStyle;
    private List<String> list;
    private AccountBD db;
    private LoginStylePop pop;
    private List<AccountBean> accountList;
    private AccountSelectPop accountPop;
    private Handler handler;
    private boolean isPswVisiable=false;
    private SharedPreferences.Editor editor;
    private SharedPreferences sp_token;

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.setContentView(R.layout.activity_login);
        ButterKnife.bind(this);
        this.sp_token = this.getSharedPreferences("token", 0);
        this.editor = this.sp_token.edit();
        rlBack.setVisibility(View.VISIBLE);
        toolbarTitle.setText("登录");
        initData();
    }

    //    public static final int ACCOUNT = 2;
//    public static final int LOGIN_STYLE = 1;
//    private List<AccountBean> accountList;
//    private AccountSelectPop accountPop;
//    private AccountBD db;
//    private SharedPreferences.Editor editor;
//    private EditText et_phonenumber;
//    private EditText et_psw;
//    private Handler handler;
//    private boolean isPswVisiable;
//    private ImageView iv_loginstyle;
//    private ImageView iv_phonenumber;
//    private ImageView iv_psw;
//    private List<String> list;
//    private int loginStyle;
//    private LoginStylePop pop;
//    private String s;
//    private SharedPreferences sp_token;
//    private String str;
//    private TextView tv_loginstyle;
//
    public LoginActivity() {
//        this.isPswVisiable = false;
        this.loginStyle = 0;
        this.list = new ArrayList<String>();
        this.handler = new Handler() {
            public void handleMessage(final Message message) {
                switch (message.what) {
                    case 1: {
                        pop.showPop();
                    }
                    case 2: {
                        accountPop.showPop();
                    }
                }
            }
        };
    }

    //
    public static void setStyle(final LoginActivity loginActivity, final int loginStyle) {
        loginActivity.loginStyle = loginStyle;
    }

    private void isSingle() {
        if (this.getIntent().getBooleanExtra("isSingle", false)) {
            ActivityManager.getInstance().SingleActivity(this);
        }
    }

    private void initData() {
        list = new ArrayList<>();
        isSingle();
        this.list.addAll(Arrays.asList(this.getResources().getStringArray(R.array.login_style)));
        this.pop = new LoginStylePop(this, this.list, ivRegistLoginstyle, tvRegistLoginstyle, new SelectPopCallback() {
            @Override
            public void onItemClick(final int n) {
                if (n == 0) {
                    LoginActivity.setStyle(LoginActivity.this, 1);
                    return;
                }
//                if (n == 1) {
//                    LoginActivity.setStyle(LoginActivity.this, 2);
//                    return;
//                }
                if (n == 2) {
                    LoginActivity.setStyle(LoginActivity.this, 29);
                    return;
                }
//                if (n == 3) {
//                    LoginActivity.setStyle(LoginActivity.this, 28);
//                    return;
//                }
//                if (n == 4) {
//                    LoginActivity.setStyle(LoginActivity.this, 27);
//                    return;
//                }
//                if (n == 5) {
//                    LoginActivity.setStyle(LoginActivity.this, 26);
//                    return;
//                }
//                if (n == 6) {
//                    LoginActivity.setStyle(LoginActivity.this, 25);
//                    return;
//                }
//                if (n == 7) {
//                    LoginActivity.setStyle(LoginActivity.this, 24);
//                    return;
//                }
                if (n == 8) {
                    LoginActivity.setStyle(LoginActivity.this,3);
                    return;
                }
                ToastUtils.showToast(LoginActivity.this,"该身份功能完善中，敬请期待");
                //公安条子专用
//                LoginActivity.setStyle(LoginActivity.this, -1);
            }
        });
        synchronized ("访问") {
            this.db = new AccountBD(this);
            this.accountList = this.db.queryAll();
            // monitorexit("\u8bbf\u95ee")
            accountPop = new AccountSelectPop(this, accountList, ivRegistPhonenumber, etRegistPhonenumber, true, new SelectPopCallback() {
                @Override
                public void onItemClick(final int n) {
                    final int style = LoginActivity.this.accountList.get(n).style;
                    String text = "";
                    if (style == 1) {
                        text = LoginActivity.this.list.get(0);
                    } else if (style == 2) {
                        text = LoginActivity.this.list.get(1);
                    } else if (style == 29) {
                        text = LoginActivity.this.list.get(2);
                    } else if (style == 28) {
                        text = LoginActivity.this.list.get(3);
                    } else if (style == 27) {
                        text = LoginActivity.this.list.get(4);
                    } else if (style == 26) {
                        text = LoginActivity.this.list.get(5);
                    } else if (style == 25) {
                        text = LoginActivity.this.list.get(6);
                    } else if (style == 24) {
                        text = LoginActivity.this.list.get(7);
                    } else if (style == 3) {
                        text = LoginActivity.this.list.get(8);
                    }
                    LoginActivity.this.tvRegistLoginstyle.setText((CharSequence) text);
                    LoginActivity.setStyle(LoginActivity.this, LoginActivity.this.accountList.get(n).style);
                }
            });
        }


    }

    @OnClick({R.id.iv_regist_phonenumber,R.id.rl_back,R.id.btn_regist_login ,R.id.ll_regist_loginstyle,R.id.iv_regist_psw,R.id.tv_login_forgetpsw,R.id.tv_login_regist})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.rl_back:
                finish();
                break;
            case R.id.iv_regist_phonenumber:
                this.pop.Show(handler, 2, this.etRegistPhonenumber);
                break;
            case R.id.ll_regist_loginstyle:
                this.accountPop.Show(handler, 1, this.etRegistPhonenumber);
                break;
            case R.id.iv_regist_psw:
                if (this.isPswVisiable) {
                    this.ivRegistPsw.setImageResource(R.drawable.regist_psw_unvisible);
                    this.etRegistPsw.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_VARIATION_PASSWORD);
                    this.isPswVisiable = false;
                    return;
                }
                this.ivRegistPsw.setImageResource(R.drawable.regist_psw_visible);
                this.etRegistPsw.setInputType(InputType.TYPE_CLASS_TEXT);
                this.isPswVisiable = true;
                break;
            case R.id.tv_login_forgetpsw:
                this.startActivity(new Intent((Context)this, (Class)ForgetPswActivity.class));
                break;
            case R.id.tv_login_regist: {
                this.startActivity(new Intent((Context)this, (Class)RegistActivity.class));
                break;
            }
            case R.id.btn_regist_login :
                final String trim = this.etRegistPhonenumber.getText().toString().trim();
                final String trim2 = this.etRegistPsw.getText().toString().trim();
                if (this.loginStyle == 0) {
                    ToastUtils.showToastWithImage(this, "请选择登陆类型", false);
                    return;
                }
                if (TextUtils.isEmpty((CharSequence)trim)) {
                    ToastUtils.showToastWithImage(this, "登陆账号不能为空", false);
                    return;
                }
                if (TextUtils.isEmpty((CharSequence)this.etRegistPsw.getText().toString().trim())) {
                    ToastUtils.showToastWithImage(this, "登陆密码不能为空", false);
                    return;
                }
                final HashMap<String, String> hashMap = new HashMap<String, String>();
                hashMap.put("username", trim);
                hashMap.put("userpwd", MD5Utils.MD5(trim2));
                hashMap.put("usertype", new StringBuilder(String.valueOf(this.loginStyle)).toString());
                hashMap.put("version", "2.0.4");
                if (ActivityManager.CHANNELID != null) {
                    hashMap.put("channelId", ActivityManager.CHANNELID);
                    hashMap.put("deviceType", "1");
                }
                OkHttpClientManager.postAsyn("http://www.51ydgy.com/appcommon/loginup", new StringPopCallBack(this,true) {
                    @Override
                    public void onResponse(String paramString) {
                        LoginBean bean = (LoginBean) GsonUtils.json2Bean(paramString, LoginBean.class);
                        if((bean != null) && (bean.code.equals("0"))) {
                            ActivityManager.loginBean = bean.data;
                            if(!db.isAccountExit(etRegistPhonenumber.getText().toString(), loginStyle)) {
                                synchronized("访问") {
                                    db.insert(etRegistPhonenumber.getText().toString(), loginStyle);
                                }
                            } else {
                                    synchronized("访问") {
                                        db.delete(etRegistPhonenumber.getText().toString(), loginStyle);
                                    }
                                    synchronized("\u8bbf\u95ee") {
                                        db.insert(etRegistPhonenumber.getText().toString(), loginStyle);
                                    }
                                    if(bean.data.status == 0) {
                                        try {
                                            String token = URLEncoder.encode(bean.data.auth.aukeyValue, "UTF-8");
                                            ActivityManager.loginBean.auth.aukeyValue = token;
                                            editor.putString("token", token).commit();
                                            ToastUtils.showToastWithImage(LoginActivity.this, bean.msg, true);
                                            ToastUtils.showToast(LoginActivity.this, bean.msg);
                                        } catch(UnsupportedEncodingException e) {
                                            e.printStackTrace();
                                        }
                                        Intent intent = new Intent(LoginActivity.this,HomeActivity.class);
                                        intent.putExtra("loginstyle", loginStyle);
                                        startActivity(intent);
                                        finish();
                                        return;
                                    }
                                    if(loginStyle == 1) {
                                        Intent intent = new Intent(LoginActivity.this, MemberRegistActivity.class);
                                        startActivity(intent);
                                        finish();
                                        return;
                                    }

                                }
                            SVProgressHUD svProgressHUD=new SVProgressHUD(LoginActivity.this);
                            svProgressHUD.showErrorWithStatus(bean.msg, SVProgressHUD.SVProgressHUDMaskType.GradientCancel);
                            }
                        }
                    });

                break;
            }

        }

    }


//    @OnClick(R.id.ll_regist_loginstyle)
//    public void onClick() {
//        this.accountPop.Show(handler, 1, this.etRegistPhonenumber);
//    }
//    public void onClick(View view) {
//        switch (view.getId()) {
//            case R.id.rl_back: {
//                this.finish();
//            }
//            case R.id.iv_regist_phonenumber: {
//                this.pop.Show(handler, 1, this.etRegistPhonenumber);
//            }
//            case R.id.ll_regist_loginstyle:
//                this.accountPop.Show(handler, 2, this.etRegistPhonenumber);
//                ToastUtils.showToast(this,"AA");
//                break;
////            case R.id.ll_regist_loginstyle: {
////                if (this.accountList.size() > 0) {
////                    this.accountPop.Show(handler, 2, this.etRegistPhonenumber);
////                    return;
////                }
////                break;
////            }
//            case 2131099843: {
//                if (this.loginStyle == -1) {
//                    final Intent intent = new Intent("android.intent.action.VIEW");
//                    intent.setData(Uri.parse("http://www.51ydgy.com"));
//                    this.startActivity(intent);
//                    return;
//                }
////                this.login();
//            }
//            //忘记密码
//            case 2131099841: {
////                this.startActivity(new Intent((Context)this, (Class)ForgetPswActivity.class));
//            }
//            //密码显示
//            case 2131099840: {
////                if (this.isPswVisiable) {
////                    this.iv_psw.setImageResource(2130837797);
////                    this.et_psw.setInputType(129);
////                    this.isPswVisiable = false;
////                    return;
////                }
////                this.iv_psw.setImageResource(2130837798);
////                this.et_psw.setInputType(144);
////                this.isPswVisiable = true;
//            }
//            //注册
////            case 2131099842: {
////                this.startActivity(new Intent((Context)this, (Class)RegistActivity.class));
////            }
//        }
//
//    private void initView() {
////        final RelativeLayout relativeLayout = (RelativeLayout)this.findViewById(2131100408);
////        final TextView textView = (TextView)this.findViewById(2131100411);
////        final LinearLayout linearLayout = (LinearLayout)this.findViewById(2131099834);
////        this.tv_loginstyle = (TextView)this.findViewById(2131099835);
////        this.iv_loginstyle = (ImageView)this.findViewById(2131099836);
////        this.et_phonenumber = (EditText)this.findViewById(2131099837);
////        this.et_psw = (EditText)this.findViewById(2131099839);
////        this.iv_psw = (ImageView)this.findViewById(2131099840);
////        this.iv_phonenumber = (ImageView)this.findViewById(2131099838);
////        final TextView textView2 = (TextView)this.findViewById(2131099842);
////        final TextView textView3 = (TextView)this.findViewById(2131099841);
////        final Button button = (Button)this.findViewById(2131099843);
////        relativeLayout.setVisibility(0);
////        textView.setText((CharSequence)this.getResources().getString(2131361823));
////        linearLayout.setOnClickListener((View.OnClickListener)this);
////        relativeLayout.setOnClickListener((View.OnClickListener)this);
////        this.iv_psw.setOnClickListener((View.OnClickListener)this);
////        textView2.setOnClickListener((View.OnClickListener)this);
////        textView3.setOnClickListener((View.OnClickListener)this);
////        button.setOnClickListener((View.OnClickListener)this);
////        this.iv_phonenumber.setOnClickListener((View.OnClickListener)this);
//    }
//
//    private void isSingle() {
//        if (this.getIntent().getBooleanExtra("isSingle", false)) {
//            ActivityManager.getInstance().SingleActivity(this);
//        }
//    }
//
//    private void login() {
//        final String trim = this.et_phonenumber.getText().toString().trim();
//        final String trim2 = this.et_psw.getText().toString().trim();
//        if (this.loginStyle == 0) {
//            ToastUtils.showToastWithImage(this, "请选择登陆类型", false);
//            return;
//        }
//        if (TextUtils.isEmpty((CharSequence)trim)) {
//            ToastUtils.showToastWithImage(this, "登陆账号不能为空", false);
//            return;
//        }
//        if (TextUtils.isEmpty((CharSequence)this.et_psw.getText().toString().trim())) {
//            ToastUtils.showToastWithImage(this, "登陆密码不能为空", false);
//            return;
//        }
//        final HashMap<String, String> hashMap = new HashMap<String, String>();
//        hashMap.put("username", trim);
//        hashMap.put("userpwd", MD5Utils.MD5(trim2));
//        hashMap.put("usertype", new StringBuilder(String.valueOf(this.loginStyle)).toString());
//        hashMap.put("version", "2.0.4");
//        if (ActivityManager.CHANNELID != null) {
//            hashMap.put("channelId", ActivityManager.CHANNELID);
//            hashMap.put("deviceType", "1");
//        }
//        try {
//            OkHttpClientManager.postAsyn("http://www.51ydgy.com/appcommon/loginup", new StringPopCallBack(this, true) {
//                @Override
//                public void onResponse(final String p0) {
//                    //
//                    // This method could not be decompiled.
//                    //
//                    // Original Bytecode:
//                    //
//                    //     1: ldc             Lcom/sz/ydgy/bean/LoginBean;.class
//                    //     3: invokestatic    com/sz/ydgy/utils/GsonUtils.json2Bean:(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;
//                    //     6: checkcast       Lcom/sz/ydgy/bean/LoginBean;
//                    //     9: astore_2
//                    //    10: aload_2
//                    //    11: ifnull          346
//                    //    14: aload_2
//                    //    15: getfield        com/sz/ydgy/bean/LoginBean.code:Ljava/lang/String;
//                    //    18: ldc             "0"
//                    //    20: invokevirtual   java/lang/String.equals:(Ljava/lang/Object;)Z
//                    //    23: ifeq            346
//                    //    26: aload_2
//                    //    27: getfield        com/sz/ydgy/bean/LoginBean.data:Lcom/sz/ydgy/bean/LoginBean$Data_Login;
//                    //    30: putstatic       com/sz/ydgy/application/ActivityManager.loginBean:Lcom/sz/ydgy/bean/LoginBean$Data_Login;
//                    //    33: aload_0
//                    //    34: getfield        com/sz/ydgy/activity/LoginActivity$4.this$0:Lcom/sz/ydgy/activity/LoginActivity;
//                    //    37: invokestatic    com/sz/ydgy/activity/LoginActivity.access$6:(Lcom/sz/ydgy/activity/LoginActivity;)Lcom/sz/ydgy/db/AccountBD;
//                    //    40: aload_0
//                    //    41: getfield        com/sz/ydgy/activity/LoginActivity$4.val$account:Ljava/lang/String;
//                    //    44: aload_0
//                    //    45: getfield        com/sz/ydgy/activity/LoginActivity$4.this$0:Lcom/sz/ydgy/activity/LoginActivity;
//                    //    48: invokestatic    com/sz/ydgy/activity/LoginActivity.access$7:(Lcom/sz/ydgy/activity/LoginActivity;)I
//                    //    51: invokevirtual   com/sz/ydgy/db/AccountBD.isAccountExit:(Ljava/lang/String;I)Z
//                    //    54: ifne            211
//                    //    57: ldc             "\u8bbf\u95ee"
//                    //    59: monitorenter
//                    //    60: aload_0
//                    //    61: getfield        com/sz/ydgy/activity/LoginActivity$4.this$0:Lcom/sz/ydgy/activity/LoginActivity;
//                    //    64: invokestatic    com/sz/ydgy/activity/LoginActivity.access$6:(Lcom/sz/ydgy/activity/LoginActivity;)Lcom/sz/ydgy/db/AccountBD;
//                    //    67: aload_0
//                    //    68: getfield        com/sz/ydgy/activity/LoginActivity$4.val$account:Ljava/lang/String;
//                    //    71: aload_0
//                    //    72: getfield        com/sz/ydgy/activity/LoginActivity$4.this$0:Lcom/sz/ydgy/activity/LoginActivity;
//                    //    75: invokestatic    com/sz/ydgy/activity/LoginActivity.access$7:(Lcom/sz/ydgy/activity/LoginActivity;)I
//                    //    78: invokevirtual   com/sz/ydgy/db/AccountBD.insert:(Ljava/lang/String;I)V
//                    //    81: ldc             "\u8bbf\u95ee"
//                    //    83: monitorexit
//                    //    84: aload_2
//                    //    85: getfield        com/sz/ydgy/bean/LoginBean.data:Lcom/sz/ydgy/bean/LoginBean$Data_Login;
//                    //    88: getfield        com/sz/ydgy/bean/LoginBean$Data_Login.status:I
//                    //    91: ifne            292
//                    //    94: aload_2
//                    //    95: getfield        com/sz/ydgy/bean/LoginBean.data:Lcom/sz/ydgy/bean/LoginBean$Data_Login;
//                    //    98: getfield        com/sz/ydgy/bean/LoginBean$Data_Login.auth:Lcom/sz/ydgy/bean/LoginBean$Auth;
//                    //   101: getfield        com/sz/ydgy/bean/LoginBean$Auth.aukeyValue:Ljava/lang/String;
//                    //   104: ldc             "UTF-8"
//                    //   106: invokestatic    java/net/URLEncoder.encode:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
//                    //   109: astore          11
//                    //   111: getstatic       com/sz/ydgy/application/ActivityManager.loginBean:Lcom/sz/ydgy/bean/LoginBean$Data_Login;
//                    //   114: getfield        com/sz/ydgy/bean/LoginBean$Data_Login.auth:Lcom/sz/ydgy/bean/LoginBean$Auth;
//                    //   117: aload           11
//                    //   119: putfield        com/sz/ydgy/bean/LoginBean$Auth.aukeyValue:Ljava/lang/String;
//                    //   122: aload_0
//                    //   123: getfield        com/sz/ydgy/activity/LoginActivity$4.this$0:Lcom/sz/ydgy/activity/LoginActivity;
//                    //   126: invokestatic    com/sz/ydgy/activity/LoginActivity.access$8:(Lcom/sz/ydgy/activity/LoginActivity;)Landroid/content/SharedPreferences$Editor;
//                    //   129: ldc             "token"
//                    //   131: aload           11
//                    //   133: invokeinterface android/content/SharedPreferences$Editor.putString:(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;
//                    //   138: invokeinterface android/content/SharedPreferences$Editor.commit:()Z
//                    //   143: pop
//                    //   144: aload_0
//                    //   145: getfield        com/sz/ydgy/activity/LoginActivity$4.this$0:Lcom/sz/ydgy/activity/LoginActivity;
//                    //   148: aload_2
//                    //   149: getfield        com/sz/ydgy/bean/LoginBean.msg:Ljava/lang/String;
//                    //   152: iconst_1
//                    //   153: invokestatic    com/sz/ydgy/utils/ToastUtils.showToastWithImage:(Landroid/content/Context;Ljava/lang/String;Z)V
//                    //   156: new             Landroid/content/Intent;
//                    //   159: dup
//                    //   160: aload_0
//                    //   161: getfield        com/sz/ydgy/activity/LoginActivity$4.this$0:Lcom/sz/ydgy/activity/LoginActivity;
//                    //   164: ldc             Lcom/sz/ydgy/activity/HomeActivity;.class
//                    //   166: invokespecial   android/content/Intent.<init>:(Landroid/content/Context;Ljava/lang/Class;)V
//                    //   169: astore          9
//                    //   171: aload           9
//                    //   173: ldc             "loginstyle"
//                    //   175: aload_0
//                    //   176: getfield        com/sz/ydgy/activity/LoginActivity$4.this$0:Lcom/sz/ydgy/activity/LoginActivity;
//                    //   179: invokestatic    com/sz/ydgy/activity/LoginActivity.access$7:(Lcom/sz/ydgy/activity/LoginActivity;)I
//                    //   182: invokevirtual   android/content/Intent.putExtra:(Ljava/lang/String;I)Landroid/content/Intent;
//                    //   185: pop
//                    //   186: aload_0
//                    //   187: getfield        com/sz/ydgy/activity/LoginActivity$4.this$0:Lcom/sz/ydgy/activity/LoginActivity;
//                    //   190: aload           9
//                    //   192: invokevirtual   com/sz/ydgy/activity/LoginActivity.startActivity:(Landroid/content/Intent;)V
//                    //   195: aload_0
//                    //   196: getfield        com/sz/ydgy/activity/LoginActivity$4.this$0:Lcom/sz/ydgy/activity/LoginActivity;
//                    //   199: invokevirtual   com/sz/ydgy/activity/LoginActivity.finish:()V
//                    //   202: return
//                    //   203: astore          13
//                    //   205: ldc             "\u8bbf\u95ee"
//                    //   207: monitorexit
//                    //   208: aload           13
//                    //   210: athrow
//                    //   211: ldc             "\u8bbf\u95ee"
//                    //   213: monitorenter
//                    //   214: aload_0
//                    //   215: getfield        com/sz/ydgy/activity/LoginActivity$4.this$0:Lcom/sz/ydgy/activity/LoginActivity;
//                    //   218: invokestatic    com/sz/ydgy/activity/LoginActivity.access$6:(Lcom/sz/ydgy/activity/LoginActivity;)Lcom/sz/ydgy/db/AccountBD;
//                    //   221: aload_0
//                    //   222: getfield        com/sz/ydgy/activity/LoginActivity$4.val$account:Ljava/lang/String;
//                    //   225: aload_0
//                    //   226: getfield        com/sz/ydgy/activity/LoginActivity$4.this$0:Lcom/sz/ydgy/activity/LoginActivity;
//                    //   229: invokestatic    com/sz/ydgy/activity/LoginActivity.access$7:(Lcom/sz/ydgy/activity/LoginActivity;)I
//                    //   232: invokevirtual   com/sz/ydgy/db/AccountBD.delete:(Ljava/lang/String;I)V
//                    //   235: ldc             "\u8bbf\u95ee"
//                    //   237: monitorexit
//                    //   238: ldc             "\u8bbf\u95ee"
//                    //   240: monitorenter
//                    //   241: aload_0
//                    //   242: getfield        com/sz/ydgy/activity/LoginActivity$4.this$0:Lcom/sz/ydgy/activity/LoginActivity;
//                    //   245: invokestatic    com/sz/ydgy/activity/LoginActivity.access$6:(Lcom/sz/ydgy/activity/LoginActivity;)Lcom/sz/ydgy/db/AccountBD;
//                    //   248: aload_0
//                    //   249: getfield        com/sz/ydgy/activity/LoginActivity$4.val$account:Ljava/lang/String;
//                    //   252: aload_0
//                    //   253: getfield        com/sz/ydgy/activity/LoginActivity$4.this$0:Lcom/sz/ydgy/activity/LoginActivity;
//                    //   256: invokestatic    com/sz/ydgy/activity/LoginActivity.access$7:(Lcom/sz/ydgy/activity/LoginActivity;)I
//                    //   259: invokevirtual   com/sz/ydgy/db/AccountBD.insert:(Ljava/lang/String;I)V
//                    //   262: ldc             "\u8bbf\u95ee"
//                    //   264: monitorexit
//                    //   265: goto            84
//                    //   268: astore          4
//                    //   270: ldc             "\u8bbf\u95ee"
//                    //   272: monitorexit
//                    //   273: aload           4
//                    //   275: athrow
//                    //   276: astore_3
//                    //   277: ldc             "\u8bbf\u95ee"
//                    //   279: monitorexit
//                    //   280: aload_3
//                    //   281: athrow
//                    //   282: astore          8
//                    //   284: aload           8
//                    //   286: invokevirtual   java/io/UnsupportedEncodingException.printStackTrace:()V
//                    //   289: goto            156
//                    //   292: aload_0
//                    //   293: getfield        com/sz/ydgy/activity/LoginActivity$4.this$0:Lcom/sz/ydgy/activity/LoginActivity;
//                    //   296: invokestatic    com/sz/ydgy/activity/LoginActivity.access$7:(Lcom/sz/ydgy/activity/LoginActivity;)I
//                    //   299: istore          5
//                    //   301: aconst_null
//                    //   302: astore          6
//                    //   304: iload           5
//                    //   306: iconst_1
//                    //   307: if_icmpne       314
//                    //   310: ldc             Lcom/sz/ydgy/activity/MemberRegistActivity;.class
//                    //   312: astore          6
//                    //   314: new             Landroid/content/Intent;
//                    //   317: dup
//                    //   318: aload_0
//                    //   319: getfield        com/sz/ydgy/activity/LoginActivity$4.this$0:Lcom/sz/ydgy/activity/LoginActivity;
//                    //   322: aload           6
//                    //   324: invokespecial   android/content/Intent.<init>:(Landroid/content/Context;Ljava/lang/Class;)V
//                    //   327: astore          7
//                    //   329: aload_0
//                    //   330: getfield        com/sz/ydgy/activity/LoginActivity$4.this$0:Lcom/sz/ydgy/activity/LoginActivity;
//                    //   333: aload           7
//                    //   335: invokevirtual   com/sz/ydgy/activity/LoginActivity.startActivity:(Landroid/content/Intent;)V
//                    //   338: aload_0
//                    //   339: getfield        com/sz/ydgy/activity/LoginActivity$4.this$0:Lcom/sz/ydgy/activity/LoginActivity;
//                    //   342: invokevirtual   com/sz/ydgy/activity/LoginActivity.finish:()V
//                    //   345: return
//                    //   346: aload_0
//                    //   347: getfield        com/sz/ydgy/activity/LoginActivity$4.this$0:Lcom/sz/ydgy/activity/LoginActivity;
//                    //   350: aload_2
//                    //   351: getfield        com/sz/ydgy/bean/LoginBean.msg:Ljava/lang/String;
//                    //   354: getstatic       com/sz/ydgy/dialog/SVProgressHUD$SVProgressHUDMaskType.GradientCancel:Lcom/sz/ydgy/dialog/SVProgressHUD$SVProgressHUDMaskType;
//                    //   357: invokestatic    com/sz/ydgy/dialog/SVProgressHUD.showErrorWithStatus:(Landroid/content/Context;Ljava/lang/String;Lcom/sz/ydgy/dialog/SVProgressHUD$SVProgressHUDMaskType;)V
//                    //   360: return
//                    //    Exceptions:
//                    //  Try           Handler
//                    //  Start  End    Start  End    Type
//                    //  -----  -----  -----  -----  --------------------------------------
//                    //  60     84     203    211    Any
//                    //  94     156    282    292    Ljava/io/UnsupportedEncodingException;
//                    //  205    208    203    211    Any
//                    //  214    238    276    282    Any
//                    //  241    265    268    276    Any
//                    //  270    273    268    276    Any
//                    //  277    280    276    282    Any
//                    //
//                    // The error that occurred was:
//                    //
//                    // java.lang.IllegalStateException: Expression is linked from several locations: Label_0156:
//                    //     at com.strobel.decompiler.ast.Error.expressionLinkedFromMultipleLocations(Error.java:27)
//                    //     at com.strobel.decompiler.ast.AstOptimizer.mergeDisparateObjectInitializations(AstOptimizer.java:2596)
//                    //     at com.strobel.decompiler.ast.AstOptimizer.optimize(AstOptimizer.java:235)
//                    //     at com.strobel.decompiler.ast.AstOptimizer.optimize(AstOptimizer.java:42)
//                    //     at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.createMethodBody(AstMethodBodyBuilder.java:214)
//                    //     at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.createMethodBody(AstMethodBodyBuilder.java:99)
//                    //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createMethodBody(AstBuilder.java:757)
//                    //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createMethod(AstBuilder.java:655)
//                    //     at com.strobel.decompiler.languages.java.ast.AstBuilder.addTypeMembers(AstBuilder.java:532)
//                    //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createTypeCore(AstBuilder.java:499)
//                    //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createTypeNoCache(AstBuilder.java:141)
//                    //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createType(AstBuilder.java:130)
//                    //     at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.transformCall(AstMethodBodyBuilder.java:1163)
//                    //     at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.transformByteCode(AstMethodBodyBuilder.java:1010)
//                    //     at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.transformExpression(AstMethodBodyBuilder.java:540)
//                    //     at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.transformByteCode(AstMethodBodyBuilder.java:554)
//                    //     at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.transformExpression(AstMethodBodyBuilder.java:540)
//                    //     at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.transformNode(AstMethodBodyBuilder.java:392)
//                    //     at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.transformBlock(AstMethodBodyBuilder.java:333)
//                    //     at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.transformNode(AstMethodBodyBuilder.java:494)
//                    //     at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.transformBlock(AstMethodBodyBuilder.java:333)
//                    //     at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.createMethodBody(AstMethodBodyBuilder.java:294)
//                    //     at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.createMethodBody(AstMethodBodyBuilder.java:99)
//                    //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createMethodBody(AstBuilder.java:757)
//                    //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createMethod(AstBuilder.java:655)
//                    //     at com.strobel.decompiler.languages.java.ast.AstBuilder.addTypeMembers(AstBuilder.java:532)
//                    //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createTypeCore(AstBuilder.java:499)
//                    //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createTypeNoCache(AstBuilder.java:141)
//                    //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createType(AstBuilder.java:130)
//                    //     at com.strobel.decompiler.languages.java.ast.AstBuilder.addType(AstBuilder.java:105)
//                    //     at com.strobel.decompiler.languages.java.JavaLanguage.buildAst(JavaLanguage.java:71)
//                    //     at com.strobel.decompiler.languages.java.JavaLanguage.decompileType(JavaLanguage.java:59)
//                    //     at us.deathmarine.luyten.DecompilerLinkProvider.generateContent(DecompilerLinkProvider.java:96)
//                    //     at us.deathmarine.luyten.OpenFile.decompileWithNavigationLinks(OpenFile.java:497)
//                    //     at us.deathmarine.luyten.OpenFile.decompile(OpenFile.java:470)
//                    //     at us.deathmarine.luyten.Model.extractClassToTextPane(Model.java:361)
//                    //     at us.deathmarine.luyten.Model.openEntryByTreePath(Model.java:279)
//                    //     at us.deathmarine.luyten.Model$TreeListener$1.run(Model.java:235)
//                    //
//                    throw new IllegalStateException("An error occurred while decompiling this method.");
//                }
//            }, hashMap);
//        }
//        catch (Exception ex) {
//            ex.printStackTrace();
//        }
//    }
//
//    public void onClick(final View view) {
//        switch (view.getId()) {
////            case 2131100408: {
////                this.finish();
////            }
////            case 2131099834: {
////                this.pop.Show(handler, 1, this.et_phonenumber);
////            }
////            case 2131099838: {
////                if (this.accountList.size() > 0) {
////                    this.accountPop.Show(handler, 2, this.et_phonenumber);
////                    return;
////                }
////                break;
////            }
////            case 2131099843: {
////                if (this.loginStyle == -1) {
////                    final Intent intent = new Intent("android.intent.action.VIEW");
////                    intent.setData(Uri.parse("http://www.51ydgy.com"));
////                    this.startActivity(intent);
////                    return;
////                }
////                this.login();
////            }
////            case 2131099841: {
////                this.startActivity(new Intent((Context)this, (Class)ForgetPswActivity.class));
////            }
////            case 2131099840: {
////                if (this.isPswVisiable) {
////                    this.iv_psw.setImageResource(2130837797);
////                    this.et_psw.setInputType(129);
////                    this.isPswVisiable = false;
////                    return;
////                }
////                this.iv_psw.setImageResource(2130837798);
////                this.et_psw.setInputType(144);
////                this.isPswVisiable = true;
////            }
////            case 2131099842: {
////                this.startActivity(new Intent((Context)this, (Class)RegistActivity.class));
////            }
//        }
//    }
//
//    @Override
//    protected void onCreate(final Bundle bundle) {
//        super.onCreate(bundle);
//        this.setContentView(R.layout.activity_login);
//        this.sp_token = this.getSharedPreferences("token", 0);
//        this.editor = this.sp_token.edit();
//        this.initView();
//        this.initData();
//    }
//
//    public void onItemSelected(final AdapterView<?> adapterView, final View view, final int loginStyle, final long n) {
//        if (loginStyle >= 0 && loginStyle <= 2) {
//            this.loginStyle = loginStyle;
//            return;
//        }
//        this.loginStyle = loginStyle + 21;
//    }
//
//    public void onNothingSelected(final AdapterView<?> adapterView) {
//    }




